<?php
#
# author: Cody Sorgenfrey
# (c)2012 South Hill Calvary Chapel
#

include_once("../mysql/database_info.php");
include_once("common.php");
include_once("../mysql/common.php");

if ($_GET['id']){

	connect_select_test("directory_contacts");
	
	$result = mysql_query("SELECT * FROM `directory_contacts` WHERE `id`='".$_GET['id']."'");
	
	$family = mysql_fetch_array($result);
	
	$famName = $family['first']." ".$family['last'];
}
else{
	
	printf("<script type='text/javascript'>window.location.href = '/directory.php';</script>");
	
}

$title = $famName; 
$meta_key= $famName.", ".$family['kids'];
$meta_desc= "The ".$family['last']." family at SHCC";
$morehtml= NULL;
$morejava= NULL;

startPage($title, $meta_key, $meta_desc, $morehtml, $morejava);
		
if ($family['picture']){

	$pic = "<img style='width:98%;' src='http://www.southhillcalvary.org".$family['picture']."'></img>";
}
else{
	
	$pic = "<img style='width:98%;' src='http://www.southhillcalvary.org/images/directory/Directory 2/blank.jpg'></img>";		
}

printf("<table style='width:%s;'>\n", "100%");

printf("\t<tr>\n");

printf("\t\t<td style='width:%s; text-align:left;'><p>\n", "50%");

if ($family['kids']) printf("<font size='%s'>Kids: </font><br>%s<br><br>","4%", $family['kids']);

if ($family['address']) printf("<font size='%s'>Address: </font><br>%s<br><br>","4%", $family['address']."<br>".$family['city']." ".$family['state']."<br>".$family['zip']);

if ($family['home#']) printf("<font size='%s'>Home: </font><br>%s<br><br>", "4%", substr($family['home#'], 6));

if ($family['cell1#']) printf("<font size='%s'>Cell: </font><br>%s %s<br><br>", "4%", substr($family['cell1#'], 6), $family['cell1name']);

if ($family['cell2#']) printf("<font size='%s'>Cell: </font><br>%s %s<br><br>", "4%", substr($family['cell2#'], 6), $family['cell2name']);

if ($family['cell3#']) printf("<font size='%s'>Cell: </font><br>%s %s<br><br>", "4%", substr($family['cell3#'], 6), $family['cell3name']);

if ($family['cell4#']) printf("<font size='%s'>Cell: </font><br>%s %s<br><br>", "4%", substr($family['cell4#'], 6), $family['cell4name']);

if ($family['work#']) printf("<font size='%s'>Work: </font><br>%s<br><br>", "4%", substr($family['work#'], 6));

if ($family['email1']) printf("<font size='%s'>Email: </font><br><a href='mailto:%s'>[%s]</a><br><br>", "4%", $family['email1'], $family['email1']);

if ($family['email2']) printf("<font size='%s'>Email 2: </font><br><a href='mailto:%s'>[%s]</a><br><br>", "4%", $family['email2'], $family['email2']);

if ($family['diff_phs_address']) printf("<font size='%s'>Physical Address: </font><br>%s<br><br>", "4%", $family['diff_phs_address']);
	
printf("\t\t</p></td>\n");
				
printf("\t\t<td style='width:%s; vertical-align:top;'>%s</td>\n", "50%", $pic);

printf("\t</tr>\n");

printf("</table>\n");

printf("<div style='width:%s; text-align:right;'><p onclick='link(\"/directory.php\")'>[Read Less]</p></div>\n", "100%");

endPage();

?>